package demo1;
import java.io.File;
import java.io.IOException;
/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 姚东名
 * Date: 2024-05-31
 * Time: 12:59
 */
public class Test {
    public static void filesdelete(File file) {
        File[] files =file.listFiles();
        for (int i=0;i<files.length;i++){
            if (files[i].isFile()){
                files[i].delete();
            }else {
                filesdelete(files[i]);
            }
        }
        file.delete();
    }

    public static void main(String[] args)  throws  IOException{
        String str ="D:\\JavaDel";
        File file =new File(str);
        filesdelete(file);
        System.out.println(file);

    }
}
